The file “Application Menu” contains some useful AppleScript commands that let you invoke the functions of the top three items in the System 7 application menu from a script. “Hide front application” hides the frontmost application (and brings another application to the front); “Hide other applications” hides all but the frontmost application; and “Show all applications” makes all application windows visible again.
To use this addition, put it in your Scripting Additions folder (inside your Extensions folder in the System Folder).
To show the usefulness of these commands, I’ve enclosed a sample “droplet” application, “Launch & Hide Others”. Drag an AppleEvent-aware application on top of this, and it should launch (if it’s not already running), come to the front, and all other running applications will be hidden. You can examine and modify the script of this with the Script Editor, if you wish.